package com.innovate.cms.modules.qs.service.order;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.innovate.cms.common.service.CrudService;
import com.innovate.cms.modules.qs.dao.order.DbOrderDao;
import com.innovate.cms.modules.qs.entity.order.DbOrder;

/**
 * 订单
 * 
 * @author shifangfang
 * @date 2017年12月28日 下午3:13:24
 */
@Service
@Transactional(readOnly = true)
public class DbOrderService extends CrudService<DbOrderDao, DbOrder> {

	@Transactional(readOnly = false)
	public int saveOrder(DbOrder dbOrder) {
		return super.dao.saveOrder(dbOrder);
	}

	/**
	 * 获取用户订单列表
	 * 
	 * @param consumerUid
	 * @return
	 */
	public List<DbOrder> orderList(String consumerUid) {
		return super.dao.orderList(consumerUid);
	}

	/**
	 * 商家核销订单
	 * 
	 * @param tradeNo
	 * @param consumeState
	 * @return
	 */
	@Transactional(readOnly = false)
	public int verifyConsumption(String tradeNo, int consumeState) {
		return super.dao.verifyConsumption(tradeNo, consumeState);
	}

	/**
	 * 获取商户订单列表
	 * 
	 * @param businessUid
	 * @return
	 */
	public List<DbOrder> businessOrderList(String businessUid) {
		return super.dao.businessOrderList(businessUid);
	}

	/**
	 * 订单/核销详情
	 * 
	 * @param tradeNo
	 */
	public DbOrder orderInfo(String tradeNo) {
		return super.dao.orderInfo(tradeNo);

	}

	/**
	 * 把预支付订单状态改为成功支付
	 * 
	 * @param tradeNo
	 * @param orderState
	 * @param transactionId
	 * @return
	 */
	@Transactional(readOnly = false)
	public int updateOrderState(String tradeNo, int orderState, String transactionId) {
		return super.dao.updateOrderState(tradeNo, orderState, transactionId);
	}


}
